﻿@model List<User_addr_book>
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>收货地址</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
    <script type="text/javascript">
        function ExecPostBack(checkValue) {
            if (arguments.length == 1) {
                ExecDelete('/submit_ajax?action=user_address_delete', checkValue, '#turl');
            } else {
                var valueArr = '';
                $("input[name='checkId']:checked").each(function (i) {
                    valueArr += $(this).val();
                    if (i < $("input[name='checkId']:checked").length - 1) {
                        valueArr += ","
                    }
                });
                ExecDelete('/submit_ajax?action=user_address_delete', valueArr, '#turl');
            }
        }
    </script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>收货地址簿</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" asp-area="Web" asp-controller="Useraddress" asp-action="Edit" asp-route-act="add">
                    <i class="iconfont icon-edit"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->

        <div class="page__bd">
            <!--收货地址列表-->
            <div class="detail-list">
                <ul>                    
                    <!--取得分页页码列表-->
                    @foreach(User_addr_book dr in Model)
                    { 
                    <li>
                        <div class="detail-bd">
                            <div class="list-box">
                                <div class="txt-box">
                                    <h2>@dr.accept_name @dr.mobile</h2>
                                    <p>@dr.email</p>
                                    <p>@dr.area@dr.address</p>
                                </div>
                            </div>
                        </div>
                        <div class="detail-ft">
                            <div class="ft-btn">
                                <div class="btn-box">
                                    <a asp-action="Edit" asp-route-id="@dr.id" asp-route-act="Edit">
                                        <i class="iconfont icon-edit"></i>编辑
                                    </a>
                                    @if(dr.is_default==0)
                                    {
                                    <a onclick="clickSubmit('/submit_ajax?action=user_address_default&id=@dr.id')" href="javascript:;">设为默认</a>
                                    }
                                    <a href="javascript:;" onclick="ExecPostBack('@dr.id');">
                                        <i class="iconfont icon-delete"></i>删除
                                    </a>
                                </div>
                            </div>
                        </div>
                    </li>
                    }
                    @if(Model.Count==0)
                    {
                    <div class="nodata">暂无记录...</div>
                    }
                </ul>
            </div>

            <!--分页页码-->
            <div class="page-list">
                @Html.Raw(ViewBag.pagelist)
            </div>
            <!--/分页页码-->

            <input id="turl" type="hidden" value="/Web/Useraddress/Index" /><!--存在跳转的URL值-->
            <!--/收货地址列表-->
        </div>

        <!--版权信息-->
        @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
        <!--/版权信息-->
        <!--底部导航-->
        @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Footer.cshtml")
        <!--/底部导航-->
    </div>
</body>
</html>
